<?php

namespace app\admin\model;

use think\Model;

/**
 * 行业分类
 * @package app\admin\model
 */
class IndustryCate extends Model
{
    /**
     * 获取行业分类
     * @param $where
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function getIndustryCate($where)
    {
        $data = self::where($where)->where('status', 1)->select();

        return $data ? $data->toArray() : [];
    }

    /**
     * 指定行业分类
     * @param $where
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function findIndustryCate($where)
    {
        $info = self::where($where)->find();

        return $info ? $info->toArray() : [];
    }

    /**
     * 行业分类指定值
     * @param $where
     * @param $field
     * @return mixed
     */
    public static function findIndustryCateValue($where, $field)
    {
        return self::where($where)->value($field);
    }

    /**
     * 新增行业分类
     * @param $data
     * @return IndustryCate|Model
     */
    public static function createIndustryCate($data)
    {
        return self::create($data);
    }

}